<?php

/**
 * sfGuardUser filter form.
 *
 * @package    vtns
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrinePluginFormFilterTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class sfGuardUserFormFilter extends PluginsfGuardUserFormFilter
{
  public function configure()
  {
	  $this->setWidgets(array(
		  'first_name'       => new sfWidgetFormFilterInput(),
		  'last_name'        => new sfWidgetFormFilterInput(),
		  'email_address'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
		  'username'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
		  'password'         => new sfWidgetFormFilterInput(),
		  'is_active'        => new sfWidgetFormChoice(array('choices' => array('' => 'có hoặc không', 1 => 'có', 0 => 'không'))),
		  'is_super_admin'   => new sfWidgetFormChoice(array('choices' => array('' => 'có hoặc không', 1 => 'có', 0 => 'không'))),
		  
		  'groups_list'      => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardGroup')),
		  'permissions_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardPermission')),
		));
		
		$this->widgetSchema->setLabels(array(
				'first_name'						=> 'Họ',
				'last_name'							=> 'Tên',
				'email_address'						=> 'Địa chỉ email',
				'username'							=> 'Tên đăng nhập',
				'password'							=> 'Mật khẩu',
				'is_active'							=> 'Kích hoạt',
				'is_super_admin'					=> 'Super Admin',
				'groups_list'						=> 'Nhóm',
				'permissions_list'					=> 'Phân quyền'
		));
	
		$this->setValidators(array(
		  'first_name'       => new sfValidatorPass(array('required' => false)),
		  'last_name'        => new sfValidatorPass(array('required' => false)),
		  'email_address'    => new sfValidatorPass(array('required' => false)),
		  'username'         => new sfValidatorPass(array('required' => false)),
		  'password'         => new sfValidatorPass(array('required' => false)),
		  'is_active'        => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
		  'is_super_admin'   => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
		  
		  'groups_list'      => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardGroup', 'required' => false)),
		  'permissions_list' => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardPermission', 'required' => false)),
		));
	
		$this->widgetSchema->setNameFormat('sf_guard_user_filters[%s]');
	
		$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
	
		$this->setupInheritance();
  }
}
